﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;

namespace Com.ContentRendering.Api.DataEngineComponentTest.Helper
{
    internal class ListHelper<T>
    {
        private List<T> _list;

        internal ListHelper()
        {
            this._list = new List<T>();
        }

        public void Add(T value)
        {
            this._list.Add(value);
        }

        public IEnumerator FetchEnumerator
        {
            get { return this._list.GetEnumerator(); }
        }

        public IEnumerator<T> FetchEnumeratorGeneric
        {
            get { return this._list.GetEnumerator(); }
        }

        public List<T> FetchList
        {
            get { return this._list; }
        }

        public ArrayList FetchArrayList
        {
            get
            {
                ArrayList arrayList = new ArrayList();

                foreach (T value in this._list)
                {
                    arrayList.Add(value);
                }

                return arrayList;
            }
        }

        public T[] FetchArray
        {
            get
            {
                T[] array = new T[this._list.Count];

                this._list.CopyTo(array);

                return array;
            }
        }
    }
}
